<template>
    <div style="width: 100%;">
        <div class="header" style="background-color: white">
            <el-page-header @back="goBack" content="投标公司账号分配">
            </el-page-header>
            <el-divider></el-divider>
        </div>

        <div style="width: 90%;margin: 0 auto">
            <div style="width: 100%;">
                <span style="font-weight: 700;font-size: 20px">|账号分配</span>
            </div>
            <el-divider></el-divider>
            <el-form style="width: 100%;" label-width="100px">
                <el-form-item label="用户名：">
                    <el-input v-model="systemUser.userName" style="width: 500px;"></el-input>
                </el-form-item>
                <el-form-item label="手机号：">
                    <el-input v-model="systemUser.userPhone" style="width: 500px;"></el-input>
                </el-form-item>
                <el-form-item label="公司名称：">
                    <el-input v-model="systemUser.userRealname" style="width: 500px;"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleResiger">注册</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
    import {SystemUserService} from "../../../model/gs/SystemUserService";

    const systemUserService = SystemUserService.getInstance()

    export default {
        data() {
            return {
                systemUser:{
                    userName:'',
                    userPhone:'',
                    userRealname:''
                }
            }
        },
        methods:{
            handleResiger(){
                systemUserService.register(this.systemUser).then(response => {
                    if(response.data.code === 0){
                        this.$message.success({
                            message:'分配成功',
                            duration:1000
                        })
                        Object.keys(this.systemUser).forEach(key => this.systemUser[key]='')
                    }
                })
            },
            goBack(){
                history.back()
            }
        }
    }
</script>

<style scoped>

</style>
